鐵人賽要進入尾聲了,
希望可以再這幾天的課程中,把Openstack剩下的安裝介紹完成
今天剩下的是我們來設置有關虛擬機器上網的路徑
我們暫時性以小規模的狀態來使用的虛擬機器的網路,
所以我們用Nova的network module 而不是選用先前介紹的Neutron專案
設定Nat for 192.168.1.0 於 br0裝置上
- Create Nova Network on Controller node
nova network-create vmnet --fixed-range-v4=192.168.1.0/24 --bridge-interface=br0
- Launch an instance on Controller node
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
ssh-keygen
nova keypair-add --pub_key ~/.ssh/id_rsa.pub mykey
nova flavor-list
nova image-list (得到 [Image_ID]填入下方)
nova boot --flavor 1 --key_name mykey --image [Image_ID] --security_group default cirrOS
nova list (得到 [VM_IP]填入下方)
ssh cirros@[VM_IP]
這邊我們來設定安裝 Cinder 這個 for vm使用的 block-storage
- Install Cinder Central Service on Controller node
apt-get install -y cinder-api cinder-scheduler
nano /etc/cinder/cinder.conf (add)
[DEFAULT]
rpc_backend = cinder.openstack.common.rpc.impl_kombu
rabbit_host = [Controller_IP]
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = RABBIT_PASS
glance_host = [Controller_IP]
[database]
connection = mysql://cinder:CINDER_DBPASS@[Controller_IP]/cinder
[keystone_authtoken]
auth_uri = http://[Controller_IP]:5000
auth_host = [Controller_IP]
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = cinder
admin_password = CINDER_PASS
mysql -u root -p
CREATE DATABASE cinder;
GRANT ALL ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
GRANT ALL ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
su -s /bin/sh -c "cinder-manage db sync" cinder
keystone user-create --name=cinder --pass=CINDER_PASS --email=cinder@example.com
keystone user-role-add --user=cinder --tenant=service --role=admin
keystone service-create --name=cinder --type=volume --description="Cinder Volume Service"
keystone endpoint-create --service-id=$(keystone service-list | awk '/ volume / {print $2}') --publicurl=http://[Controller_IP]:8776/v1/%\(tenant_id\)s --internalurl=http://[Controller_IP]:8776/v1/%\(tenant_id\)s --adminurl=http://[Controller_IP]:8776/v1/%\(tenant_id\)s
keystone service-create --name=cinderv2 --type=volumev2 --description="Cinder Volume Service V2"
keystone endpoint-create --service-id=$(keystone service-list | awk '/ volumev2 / {print $2}') --publicurl=http://[Controller_IP]:8776/v2/%\(tenant_id\)s --internalurl=http://[Controller_IP]:8776/v2/%\(tenant_id\)s --adminurl=http://[Controller_IP]:8776/v2/%\(tenant_id\)s
service cinder-scheduler restart
service cinder-api restart
- Install Cinder LVM Volume Service on Controller nodes
apt-get install -y lvm2 cinder-volume
dd if=/dev/zero of=/root/cinder-volumes.img bs=1M seek=100000 count=0
losetup /dev/loop0 /root/cinder-volumes.img (加載裝置)
(可加到/etc/rc.local)
losetup -a
pvcreate /dev/loop0
vgcreate cinder-volumes /dev/loop0
vgdisplay
nano /etc/lvm/lvm.conf
devices {
filter = [ "a/loop0/","r/.*/"]
}
service cinder-volume restart
service tgt restart
- Installing the OpenStack Dashboard
apt-get install -y apache2 memcached libapache2-mod-wsgi openstack-dashboard
apt-get remove -y --purge openstack-dashboard-ubuntu-theme
nano /etc/openstack-dashboard/local_settings.py
OPENSTACK_HOST = "[Controller_IP]"
ALLOWED_HOSTS = ['localhost', '[Controller_IP]','[Controller_Hostname]']
service apache2 restart
service memcached restart
明天將邁入最後一天,介面操作!!
Day 29 Ending